package ec.linde.modulos.recursos;

import javax.faces.context.FacesContext;


public class MensajeContext {
	FacesContext facesContext;
	public void setFaceContextMensaje(String key,Object objValor){
		try{
		facesContext=FacesContext.getCurrentInstance();
		facesContext.getExternalContext().getSessionMap().put(key, objValor);	
		}catch (Exception e) {
			
		}
	}
	public Object getFaceContextMensaje(String key){
		Object obj=new Object();
		try{
		facesContext=FacesContext.getCurrentInstance();
		obj= facesContext.getExternalContext().getSessionMap().get(key);
		}catch (Exception e) {
			
		}
		return obj;
	}
	
	public void expirarBean(String key){
		FacesContext context = FacesContext.getCurrentInstance();
		context.getExternalContext().getSessionMap().remove(key);
	}
	public boolean contieneKey(String key){
		boolean esNull=true;
		try{
		facesContext=FacesContext.getCurrentInstance();
		esNull= facesContext.getExternalContext().getSessionMap().containsKey(key);
		}catch (Exception e) {
			
			esNull=true;
		}
		return esNull;
	}
	
}
